<f:subview xmlns:f="http://java.sun.com/jsf/core"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:nxh="http://nuxeo.org/nxweb/html"
  xmlns:nxu="http://nuxeo.org/nxweb/util"
  xmlns:nxdir="http://nuxeo.org/nxdirectory"
  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
  id="#{widget.id}">

  <c:if test="#{widget.mode != 'edit'}">

    <nxh:outputLink
      value="#{nxd:complexFileUrl('downloadFile', layoutValue, widget_0.fieldDefinitions[0].propertyName, model.rowIndex, widget.fieldDefinitions[0].propertyName, field_1)}">
      <nxh:graphicImage value="#{nxd:fileIconPath(field_0)}"
        rendered="#{! empty nxd:fileIconPath(field_0)}" />
      <nxh:outputText value="#{field_1}" />
    </nxh:outputLink>

    <nxu:methodResult name="hasPDFCapabilities"
      value="#{conversionActions.isExportableToPDF(field_0)}">
      <h:panelGroup rendered="#{hasPDFCapabilities}">
        <h:outputText value=" | " />
        <h:commandLink action="#{conversionActions.generatePdfFile}">
          <f:param name="fileFieldFullName"
            value="#{nxd:propertyPath(widget_0.fieldDefinitions[0].propertyName, model.rowIndex, widget.fieldDefinitions[0].propertyName)}" />
          <f:param name="filename" value="#{field_1}" />
          <f:param name="docRef" value="#{layoutValue.id}" />
          <h:outputText value="#{messages['label.document.generatePdf']}" />
        </h:commandLink>
      </h:panelGroup>
    </nxu:methodResult>

  </c:if>

  <c:if test="#{widget.mode == 'edit'}">

    <nxu:inputFile id="#{widget.id}_file" value="#{field_0}"
      filename="#{field_1}" required="#{widgetProperty_required}" editFilename="false" />
    <h:message escape="false" styleClass="errorMessage" for="#{widget.id}_file"
      id="#{widget.id}_message" />

  </c:if>

</f:subview>
